<?php

require __DIR__ . '/../../../vendor/autoload.php';

use Gateway\app\faceContrast\FaceContrastVerifyRequest;
use Gateway\ESGateway;
use Gateway\JSONUtil;
use Gateway\Log;

$appCode = "d2808c1338ce01f3e3efdb486f9effb9";
$algo = "3";
$key = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEhdQdw6uTGz+X4e+/eGpu4dcKrfrjQAe0tTQyn6TuKBobcsUsESkx9jcCeG4cpuxmN8jNeDAZsbTujNLD/aYl2g==";
$esGateway = new ESGateway($appCode, $algo, $key);

$faceContrastVerify = new FaceContrastVerifyRequest();
$path = 'resources'.DIRECTORY_SEPARATOR.'cn_idcard.jpeg';//拼接路径
$imageData =file_get_contents($path);
$base64String  = base64_encode($imageData);
$faceContrastVerify->image = $base64String;
$faceContrastVerify->uuid = "1231234314";
$faceContrastVerify->imageUrl ="http://www.baidu.com";
$faceContrastVerify->token = "kbi+dIKhrfdn177jS3yYw9Rv+GfkJXNbIRpJUbqSXRbqbw+HtkFAv4JT9doMBWZXjJ+QuLkIXnA2ogFG9zrPny09nWvWP3n/6oJblI8Be/E=";
$faceContrastVerify->verifyMsg = "asdjhasjkzxclkasldkjasldasdasd";

$gatewayResponse = $esGateway->sendToGateWay(FaceContrastVerifyRequest::$act,$faceContrastVerify->toJsonStr());
Log::DEBUG("服务器返回数据：".$gatewayResponse->toJsonStr());
if ($gatewayResponse->bizContent != null) {
    Log::DEBUG("业务数据为：".$gatewayResponse->bizContent);
    $rsp = JSONUtil::fromJsonStr($gatewayResponse->bizContent);
}
